//通用any
export interface ProtobufAny {
  "@type": string;
  value: any;
  setValue(value: any): void;
}

//Int32
export class Int32Any implements ProtobufAny {
  "@type" = "type.googleapis.com/google.protobuf.Int32Value";
  value: number = 0;
  constructor(value?: number) {
    if (value) {
      this.value = value;
    }
  }
  setValue(value: number) {
    this.value = Math.floor(value);
  }
}

//Int64
export class Int64Any implements ProtobufAny {
  "@type" = "type.googleapis.com/google.protobuf.Int64Value";
  value: number = 0;
  constructor(value?: number) {
    if (value) {
      this.value = value;
    }
  }
  setValue(value: number) {
    this.value = Math.floor(value);
  }
}

//Boolean
export class BoolAny implements ProtobufAny {
  "@type" = "type.googleapis.com/google.protobuf.BoolValue";
  value: boolean = false;
  constructor(value?: boolean) {
    if (value) {
      this.value = value;
    }
  }
  setValue(value: boolean) {
    this.value = value;
  }
}

//String
export class StringAny implements ProtobufAny {
  "@type" = "type.googleapis.com/google.protobuf.StringValue";
  value: string = "";
  constructor(value?: string) {
    if (value) {
      this.value = value;
    }
  }
  setValue(value: string) {
    this.value = value;
  }
}
